package com.CoreryBlack.Mapper;

import com.CoreryBlack.po.Dept;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @Description DeptMapper
 * @Author CoreryBlack
 * @Date 2024-09-20
 */
@Mapper
public interface DeptMapper {

    /**
     * 查询所有部门
     * @return
     */
    @Select("select id,name,create_time as createTime ,update_time as updateTime from web.dept")
    public List<Dept> findAll();

    /**
     * 根据id删除部门
     * @param id
     */
    @Delete("delete from web.dept where id = ${id}")
    void deleteById(Integer id);

    @Insert("insert into web.dept(name,create_time,update_time) values (#{name},#{createTime},#{updateTime})")

    void insert(Dept dept);

    @Select("select * from web.dept where id = ${id}")
    Dept getById(Integer id);

    void updateById(Dept dept);
}